#include<bits/stdc++.h>

using namespace std;

int findMissMin(int A[], int n) {
    int B[n + 1];
    memset(B, 0, sizeof(int) * (n + 1));
    for (int i = 0; i < n; i++)
        if (A[i] > 0)
            B[A[i]] = 1;
    for (int i = 1; i < n + 1; i++)
        if (B[i] == 0)
            return i;
    return n + 1;
}

int main() {
    //  测试
    int n1 = 4;
    int num1[] = {-5, 3, 2, 3};
    int n2 = 3;
    int num2[] = {1, 2, 3};
    cout << findMissMin(num1, n1) << endl;
    cout << findMissMin(num2, n2) << endl;
    return 0;
}